/**
 * 
 */
package com.eagle.coders.security.beans;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * @author Anees
 *
 */
@Entity
@Table(name = "eg_role_func")
@SequenceGenerator(name="roleFunc_gen_seq", sequenceName="eagle_gen_seq")
public class RolesFunctionAccessBean implements Serializable {

	private static final long serialVersionUID = 1L;

	private Integer id;
	
	private RolesBean role;
	
	private FunctionsBean function;
	
	private Integer accessOnFunction;

	/**
	 * @return the id
	 */
	@Id
	@GeneratedValue(generator="roleFunc_gen_seq", strategy=GenerationType.SEQUENCE)
	public Integer getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return the role
	 */
	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinColumn(name = "role_id", referencedColumnName = "id")
	public RolesBean getRole() {
		return role;
	}

	/**
	 * @param role the role to set
	 */
	public void setRole(RolesBean role) {
		this.role = role;
	}

	/**
	 * @return the function
	 */
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinColumn(name = "func_id", referencedColumnName = "id")
	public FunctionsBean getFunction() {
		return function;
	}

	/**
	 * @param function the function to set
	 */
	public void setFunction(FunctionsBean function) {
		this.function = function;
	}

	/**
	 * @return the accessOnFunction
	 */
	@Column(name="func_access")
	public Integer getAccessOnFunction() {
		return accessOnFunction;
	}

	/**
	 * @param accessOnFunction the accessOnFunction to set
	 */
	public void setAccessOnFunction(Integer accessOnFunction) {
		this.accessOnFunction = accessOnFunction;
	}
	
	
}
